package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.CheckItem;
import com.itheima.service.CheckItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.POST;

@RestController
@RequestMapping("/checkitem")
//xiongxiang
public class CheckItemController {

    //@Reference
    //123
    //adadad1//测试
    //测试123
    //测试123123
    //测试123123123123
    //312
    //123123
    CheckItemService checkItemService;
    //123123
    //123123//测试
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Result add(@RequestBody CheckItem checkItem){
       return checkItemService.add(checkItem);
    }
    //测试
    //123123
    //123123123
    @RequestMapping(value = "/findPage",method = RequestMethod.POST)
    public PageResult page(@RequestBody QueryPageBean queryPageBean){
        return checkItemService.findByPage(queryPageBean);
        //123
        //456
        //789
        //qweqwe
    }

    @RequestMapping(value = "/delete/{id}",method = RequestMethod.DELETE)
    public Result delete(@PathVariable Integer id){
        return checkItemService.delete(id);
    }

    @RequestMapping(value = "/update",method = RequestMethod.PUT)
    public Result page(@RequestBody CheckItem checkItem){
        return checkItemService.update(checkItem);
    }

    @RequestMapping(value = "/findById/{id}",method = RequestMethod.GET)
    public Result findById(@PathVariable Integer id){
        return checkItemService.findById(id);
    }
    //查询所有
    @RequestMapping(value = "/findAll",method = RequestMethod.GET)
    public Result findAll(){
        return checkItemService.findAll();
    }

}

//123
